# # 1. 求 1 - 100 的和
# sum = 0
# for i in range(1, 101):
# sum += i
# print(sum)
# # 2. 求 300 - 400 的和
# sum = 0
# for i in range(300, 401):
# sum += i
# print(sum)
# # 3. 求 1 - 1000 的和
# sum = 0
# for i in range(1, 1001):
#  sum += i
# print(sum)

# # 定义函数
# def calcSum(beg, end):
#         sum = 0
#         for i in range(beg, end + 1):
#           sum += i
#         print(sum)
# # 调用函数
# sum(1, 100)
# sum(300, 400)
# sum(1, 1000)

#1.求1-100的和
theSum = 0
for i in range(1,101):
    theSum += i
print("1-100的和:",theSum)

#2.求300-400的和
theSum = 0
for i in range(300,401):
    theSum += i
print("300-400的和:",theSum)


#3.求1-1000的和
theSum = 0
for i in range(1,1001):
    theSum += i
print("1-1000的和:",theSum)



























